<template>
  <div class="my">
    <head-view>
      <span slot="center">用户</span>
      <span slot="right"><i class="el-icon-search"></i></span>
    </head-view>
    <div class="tit-img">
      <img src="../assets/tit_img.jpg" alt="" />
    </div>
    <div v-if="islogin != null">
      <p>糖葫芦</p>
      <button class="btn" @click="loguin">立即退出</button>
    </div>
    <div v-else>
      <p>请登录</p>
      <button class="btn2" @click="login">立即登录</button>
    </div>
    <div class="bottom">
      <div class="tp">
        <i class="el-icon-shopping-cart-2"></i>
        <p>地址管理</p>
        <i class="el-icon-arrow-right"></i>
      </div>
      <div class="dp">
        <i class="el-icon-star-off"></i>
        <p>收藏管理</p>
      </div>
    </div>
    <nav-view></nav-view>
  </div>
</template>
<script>
import HeadView from "@/components/HeadView.vue";
import NavView from "../components/NavView.vue";

export default {
  components: { NavView, HeadView },
  data() {
    return {
      islogin: localStorage.getItem("tel"),
    };
  },
  methods: {
    login() {
      this.$router.push("/");
    },
    loguin() {
      localStorage.removeItem("tel");
      this.$router.push("/");
    },
  },
};
</script>
<style lang="scss" scoped>
.my {
  height: 100vh;
}
.tit-img {
  width: 80px;
  height: 80px;
  border-radius: 40px;
  margin: 20px auto 10px;
  overflow: hidden;
  img {
    width: 100%;
  }
}
p {
  text-align: center;
  font-size: 20px;
}
.btn,
.btn2 {
  width: 340px;
  border: 0;
  background: red;
  color: #fff;
  height: 45px;
  margin: 50px 15px 20px;
  font-size: 18px;
}
.btn2 {
  background: #00c562;
}
.bottom {
  height: 100px;
  display: flex;
  flex-direction: column;
  background: #fff;
  font-size: 18px;
  .tp {
    line-height: 50px;
    display: flex;
    justify-content: space-around;
    text-align: center;
    border-bottom: 1px solid #fcfcfd;
    p {
      flex: 4;
      text-align: left;
    }
    i {
      font-size: 21px;
      flex: 1;
      line-height: 50px;
    }
  }
  .dp {
    display: flex;
    justify-content: space-around;
    line-height: 50px;
    i {
      line-height: 50px;
      flex: 1;
      text-align: center;
      font-size: 21px;
    }
    p {
      flex: 5;
      text-align: left;
    }
  }
}
</style>
